#include "ustandard/ustandard_def.h"
static jmp_buf env;

double divide(double to, double by)
{
    if(by == 0)
        longjmp(env, 1);

    return to / by;
}

void f(int n) 
{
    if (setjmp(env) == 0)
        printf("divide return %lf\n", divide(2, n));
    else
        printf("Cannot / 0.\n");

    printf("done.\n");
}


int main()
{
    int n = 10;

    while(1) {
        printf("n=%d\n", n);
        f(n);

        n -- ;
        sleep(1);
    }

    return 0;
}
